<?php
class Q_Rule_Range extends Q_Rule_Abstract {

    /**
     * The parameters that were passed to this rule
     */
    protected $_params = array(
        'field' => 0, // default is zero because this allows $rule->validate('some text')
        'min' => null,
        'max'=> null,
    );
    /**
     * 
     */
    public function isValid($value) {
    
		// Only maximum defined
		if ($this->getParam('min') == NULL) {
			return ($value <= $this->getParam('max'));
		}
		// Only minimum defined
		if ($this->getParam('max') == NULL) {
			return ($value >= $this->getParam('min'));
		}
		// Range defined
		return (($this->getParam('min') <= $value) && ($value <= $this->getParam('max')));
    
    }

}